<template>
	<view>
		<view class="list">
			<view class="list-one" v-for="(item, list) in consultlist" :key="list" @click="click_listone(item)">
				<view class="left">
					<u--image width="236rpx" height="236rpx" :src="item.logo ? item.logo : 'http://cdn.uviewui.com/uview/empty/data.png'" radius="4">
						<template v-slot:loading>
							<u-loading-icon color="#39488a"></u-loading-icon>
						</template>
					</u--image>
				</view>
				<view class="right">
					<view class="tit two">{{ item.title }}</view>
					<view class="bottm">
						<u-parse :content="item.summary"></u-parse>
					</view>
					<view class="time">{{ item.createTime }}</view>
				</view>
			</view>
		</view>
		<u-empty :show="consultlist.length==0&&loading?true:false" marginTop="100"></u-empty>
		<u-loadmore :status="loadstatus" line v-if="consultlist.length>0"/>
		<view style="height: 140rpx;"></view>
	</view>
</template>

<script>
import { hnbtpage } from '@/api/index.js';
export default {
	data() {
		return {
			consultlist: [],
			queryParams: {
				pageNo: 1,
				pageSize: 10
			},
			loading:false,
			loadstatus:'loading'
		};
	},
	onLoad() {
		this.get_zjzx();
	},
	methods: {
		get_zjzx() {
			hnbtpage(this.queryParams).then((res) => {
				this.loading = true;
				if (res.data.list.length == 0 && this.queryParams.pageNo > 1) {
					this.loadstatus = 'nomore';
					return;
				}
				if (this.queryParams.pageNo == 1 && res.data.list.length < 10) {
					this.loadstatus = 'nomore';
				}
				this.consultlist = this.consultlist.concat(res.data.list);
				this.queryParams.pageNo = res.data.list.length == 0 ? this.queryParams.pageNo : (this.queryParams.pageNo += 1);
			});
		},
		click_listone(list) {
			uni.navigateTo({
				url: '/pages/index/subsidy/details/details?id=' + list.id
			});
		},
	},
	onPullDownRefresh() {
		this.queryParams.pageNo = 1;
		this.consultlist = [];
		this.get_zjzx();
	},
	onReachBottom() {
		this.get_zjzx();
		this.loadstatus = 'loading';
	}
};
</script>

<style lang="scss">
.list {
	padding: 24rpx;
	.list-one {
		padding: 12rpx;
		display: flex;
		background: #FFFFFF;
		box-shadow: 0px 8rpx 40rpx 0px rgba(0,0,0,0.1);
		border-radius: 12rpx;
		margin-bottom: 20rpx;
		.left {
			margin-right: 22rpx;
			image {
				width: 236rpx;
				height: 236rpx;
			}
		}
		.right {
			flex: auto;
			.tit {
				font-size: 28rpx;
				font-weight: bold;
				line-height: 36rpx;
				min-height: 72rpx;
			}
			.bottm {
				margin-top: 12rpx;
				font-size: 24rpx;
				line-height: 36rpx;
				color: #666666;
				min-height: 108rpx;
			}
			.red {
				color: red;
			}
			.time{
				margin-top: 12rpx;
				color: #666666;
				font-size: 24rpx;
				line-height: 36rpx;
			}
		}
	}
}
</style>
